﻿using System;
using ATM.Terminal.Models;
using ATM.Terminal.Rendering.Base;
using ATM.Terminal.Screens.Base;

namespace ATM.Terminal.Screens
{
    public class InformationScreen : ScreenBase
    {
        private readonly AccountModel _currentAccount;

        public InformationScreen(AccountModel account)
        {
            _currentAccount = account;
        }

        public override void Render(RenderTargetBase renderTarget)
        {
            renderTarget.Render(new ScreenModel()
            {
                Title = "Information Screen",
                Content = new[]
                        {
                            string.Format("Welcome {0} {1}", _currentAccount.FirstName, _currentAccount.LastName),
                            string.Format("Account Number: {0}", _currentAccount.AccountNumber),
                            string.Format("Balance: {0}", _currentAccount.Balance),
                            "Press Enter to exit."
                        }
            });
        }

        public override void ProcessInput(ConsoleKeyInfo input)
        {
            switch (input.Key)
            {
                case ConsoleKey.Enter:
                    base.RaiseScreenChange(new WelcomeScreen());
                    break;
            }
        }
    }
}
